<!DOCTYPE html>
<html>
<head>
<title>模板- home</title>
<link href="css/style.css" rel='stylesheet' type='text/css' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Pink Contact Form ,Login Forms,Sign up Forms,Registration Forms,News latter Forms,Elements"./>
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
	<h1>请假申请表</h1>
	<div class="login-01" id="app">
			<form>
				<ul>
				<li class="first">
					<a href="#" class=" icon user"></a><input type="text" class="text" v-model="pname"  placeholder="姓名" >
					<div class="clear"></div>
				</li>
				<li class="first">
					<a href="#" class=" icon email"></a><input type="text" class="text" v-model="rsdate" placeholder="开始日期(yyyy-mm-dd)">
					<div class="clear"></div>
				<li class="first">
					<a href="#" class=" icon phone"></a><input type="text" class="text" v-model="redate" placeholder="截止日期(yyyy-mm-dd)" >
					<div class="clear"></div>
				</li>
				<li class="first">
					<a href="#" class=" icon user"></a><input type="text" class="text" v-model="rtype"  placeholder="假期类型(事假或年假或病假)" >
					<div class="clear"></div>
				</li>
				<li class="first">
					<a href="#" class=" icon user"></a><input type="text" class="text" v-model="rinfo"  placeholder="病假请填写理由" >
					<div class="clear"></div>
				</li>				
			</ul>
			<input type="button" v-on:click="submit" value="Submit" >
			<div class="clear"></div>
		</form>
	</div>
	<script>
		var vm = new Vue({
			el:'#app',
			data:{
				pid:'',
				pname:'',
				rsdate:'',
				redate:'',
				rtype:'',
				rinfo:'',
			},
			methods:{
				submit(){
					var jsondata = sessionStorage.getItem("json");
		            var user = JSON.parse(jsondata);
		            this.pid = user.pid;
					var params = new URLSearchParams();
            		params.append('rsdate', this.rsdate);
            		params.append('redate',this.redate);
            		params.append('rtype', this.rtype);
            		params.append('rinfo', this.rinfo);
            		params.append('pid', this.pid);
                	axios.post('http://localhost:8080/WebDemo/AddRequestServlet',params).then(function(res){              		
                        alert("提交成功");
                        window.location.href = "http://localhost:8080/WebDemo/frontend/main/content.html";
                    });
				}
			},
		})
	</script>
</body>
</html>